<template>
    <div id="inputNumber">
        <div class="inleft" @click="substrict">-</div>
        <div class="incenter" v-text="count"></div>
        <div class="inright" @click="add">+</div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            count: 1
        }
    },
    methods: {
        substrict() {
            this.count--;
            if (this.count < 1) {
                this.count = 1;
            }
             this.sendcount();
        },
        add() {
            this.count++;
            this.sendcount();
        },
        sendcount(){
            this.$emit('dataobj',this.count);
        }
    }

}
</script>
<style scoped>
#inputNumber{
    display: inline-block;
}
#inputNumber div {
    width: 30px;
    height: 20px;
    border: 1px solid #000;
    text-align: center;
    line-height: 20px;
    display: inline-block;
}
</style>

